#!/usr/bin/env python
# coding:utf-8

__author__ = "SQL-RICE Proyect"

__copyright__ = "Copyright (C) 2012 Daniel Contreras, Jan Gallardo, Alejadro Peña, Jesus Rojas, Gustavo Rubio,"

__license__ = "GPLv3"

__version__ = "0.1"
import unittest
from sql_rice import rules


class TestValidations(unittest.TestCase):

    def setUp(self):
        rules.metadata.bind = 'sqlite:///:memory:'

        rules.models.setup_all(True)
        v = rules.Validator(name='rut', params={}, rules=[])
        f = rules.Validator(name='date', params={}, rules=[])
        n = rules.Validator(name='natural', params={}, rules=[])
        m = rules.Validator(name='limit', params={'maximum':100},
                                    rules=[])
        rules.Rule(pattern='rut', apply_to='fields', validators=[v],
                          default='replace')
        rules.Rule(pattern='fecha', apply_to='fields',
                          validators=[f], default='replace')
        rules.Rule(pattern='edad', apply_to='fields',
                          validators=[m, n], default='replace')
        rules.session.commit()

    #def test_validate_rut(self):
        #self.assertItemsEqual([rules.rut({})], rules.find(u'rut'))

    #def test_validate_nombre(self):
        #self.assertItemsEqual([], rules.find(u'nombre'))

    #def test_validate_fecha(self):
        #self.assertListEqual([rules.date({})], rules.find(u'fecha'))
    
    #def test_validate_range_and_Inter(self):
        #self.assertListEqual([rules.natural({})],
                               #rules.find(u'edad'))
